package com.hao.servlet;

import com.hao.entity.product;
import com.hao.service.productservice;
import com.hao.serviceImpl.productserviceImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by Administrator on 2018/8/3.
 */
public class Servletupd extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();

        product zz=new product();
        zz.setEid(Integer.parseInt(request.getParameter("eid")));
        zz.setEnumber(request.getParameter("enumber"));
        zz.setManufactureTime(request.getParameter("manufactureTime"));
        zz.setUserid(Integer.parseInt(request.getParameter("userid")));
        zz.setWpid(Integer.parseInt(request.getParameter("wpid")));
        zz.setInstall(Integer.parseInt(request.getParameter("install")));
        zz.setAllocationDate(request.getParameter("allocationDate"));


        productservice mm=new productserviceImpl();
        int i=mm.upd(zz);


        if(i>0){
            out.print("<script language='javascript'> parent.layer.close(parent.layer.getFrameIndex(window.name));</script>");
        }else{
            out.print("<script language='javascript'>history.go(-1);alert('删除失败');</script>");
        }
        out.flush();
        out.close();



    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                doPost(request,response);
    }
}
